﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QPaintEvent>
#include <QTimerEvent>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

    int getTimer(int id)
    {
        return id;
    }

    /* 在派生类中重写鼠标事件处理函数 */
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseDoubleClickEvent(QMouseEvent *event);
    void leaveEvent(QEvent *event);
    void enterEvent(QEvent *event);

    /* 重写键盘事件 */
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);

    /* 绘图事件 */
    void paintEvent(QPaintEvent *event);

    /* 定时器事件 */
    void timerEvent(QTimerEvent *event);

    //在派生类中重写所有事件的事件处理函数
    bool event(QEvent *event);

private:
    Ui::Widget *ui;

     int timerID1;
     int timerID2;
     int timerID3;

};



#endif // WIDGET_H
